﻿@page "/polarSimple"

<h3>Polar Simple</h3>

<Chart Config="_config1" @ref="_chart1" Height="400px"></Chart>

<hr />

<h3>Code</h3>

<p>
    This is the component to add in your page.
</p>

<CodeSnippet Language="Language.xml" Style="Style.VisualStudio">
&ltChart Config="_config1" &#64;ref="_chart1">&lt;Chart>
</CodeSnippet>

<p>
    Then, in the code section, add the following code:
</p>

<CodeSnippet Language="Language.csharp" Style="Style.VisualStudio" LoadMainScript="false">
private PolarChartConfig? _config1;
private Chart? _chart1;

protected override async Task OnInitializedAsync()
{
    _config1 = new PolarChartConfig()
    {
        Options = new Options()
        {
                Responsive = true,
                MaintainAspectRatio = false
        }
    };

    _config1.Data.Labels = PolarDataExamples.SimplePolarText;
    _config1.Data.Datasets.Add(new PolarDataset()
    {
        Label = "Value",
        Data = PolarDataExamples.SimplePolar,
        BackgroundColor = Colors.Palette1,
    });
}
</CodeSnippet>

@code {
    private PolarChartConfig? _config1;
    private Chart? _chart1;

    protected override async Task OnInitializedAsync()
    {
        _config1 = new PolarChartConfig()
        {
            Options = new Options()
            {
                 Responsive = true,
                 MaintainAspectRatio = false
            }
        };

        _config1.Data.Labels = PolarDataExamples.SimplePolarText;
        _config1.Data.Datasets.Add(new PolarDataset()
        {
            Label = "Value",
            Data = PolarDataExamples.SimplePolar,
            BackgroundColor = Colors.Palette1,
        });
    }
}